import React from 'react';
import { RouterProvider } from 'react-router-dom';
import { ConfigProvider } from 'antd';
import { i18n } from '@lingui/core';
import { I18nProvider } from '@lingui/react';
import { defaultLocale, locales } from './i18n';
import AppStore from './stores/AppStore';
import type { AppStoreParams } from './stores/AppStore';
import systemRoutes from './router/systemRoutes';

ConfigProvider.config({
  prefixCls: 'ant4-23',
});

export interface AppProps extends AppStoreParams {}

function App({ ws, tabPageTodo }: AppProps) {
  return (
    <I18nProvider i18n={i18n}>
      <ConfigProvider locale={locales[defaultLocale]?.antd} prefixCls="ant4-23">
        <AppStore.Provider initialState={{ ws, tabPageTodo }}>
          <RouterProvider router={systemRoutes} />
        </AppStore.Provider>
      </ConfigProvider>
    </I18nProvider>
  );
}

export default App;
